<template>
	<view>
		<view v-if="shortTime" class="py-2 flex align-center justify-center font-sm text-light-muted">
			{{shortTime}}
		</view>
		<!-- 消息气泡 -->
		<view class="flex px-2 my-2" :class="isSelf ? 'flex-row-reverse' : ''">
			<image :src="item.avatar" style="width: 100rpx;height: 100rpx;"></image>
			<view class="p-2 rounded bg-light mx-2" style="max-width: 400rpx;">{{item.data}}</view>
		</view>
	</view>
</template>

<script>
	// 模拟当前登录用户id
	const uid = 1
	import $T from '@/common/css/time.js'
	export default {
		props: {
			item: Object,
			index: Number,
			pretime: [Number, String]
		},
		computed: {
			isSelf() {
				return uid === this.item.user_id
			},
			shortTime() {
				return $T.getChatTime(this.item.create_time, this.pretime)
			}
		},
	}
</script>

<style>
</style>
